home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 476-500 / disk_481 / wavemaker / utils.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  799b  |  43 lines

  1. #include <exec/types.h>
  2.  
  3. /****************************************************************/
  4. USHORT amptopot(amp)
  5.  
  6. /* Convert an amplitude to an integer to put in the proportional */
  7. /* gadget's VertPot value.                                       */
  8.  
  9. LONG amp;
  10. {
  11.     USHORT temp;
  12.     
  13.     temp = (127-abs(amp))<<9;
  14.     return(temp);
  15. }
  16.  
  17. /****************************************************************/
  18. LONG pottoamp(pot,potsign)
  19.  
  20. /* Converts a proportional gadget's VertPot value to an amplitude  */
  21.  
  22. USHORT pot;
  23. SHORT potsign;
  24. {
  25.     LONG temp;
  26.     temp = (127-(pot>>9))*potsign;
  27.     return(temp);
  28. }
  29.  
  30.  
  31. /************************************************************/
  32. LONG randamp()
  33.  
  34. /*  Picks a random amplitude (for the game mode)  */
  35.  
  36. {
  37.     LONG temp;
  38.     
  39.     temp=(rand()&0xFF)-127;
  40.     if (temp==128) temp=127;
  41.     return(temp);
  42. }
  43.